<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function myInstance(left, right) {
        let RP = right.prototype;
        let LP = left.__proto__;

        while (true) {
          if (LP == null) return false;
          if (RP == LP) return true;
          LP = Object.getPrototypeOf(LP);
        }
      }
      console.log(myInstance({ a: 1 }, Object));
      console.log(myInstance([1, 2], Array));
    </script>
  </body>
</html>
